/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package control.accion;

import java.awt.Container;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JPanel;

/**
 *
 * @author tuareg
 */
public class Atras extends AbstractAction {

    public Atras(JPanel aDondeVolver, Container enDondeVolver) {
        this.volver = aDondeVolver;
        this.contenedor = enDondeVolver;
        putValue(Action.SHORT_DESCRIPTION, "Volver a la ventana anterior");
        putValue(Action.NAME, "VOLVER");
        putValue(Action.SMALL_ICON, new javax.swing.ImageIcon(getClass().getResource("/frontera/recursos/back.png")));
    }

    public void actionPerformed(ActionEvent e) {
        contenedor.setVisible(false);
        contenedor.removeAll();
        contenedor.add(volver);
        contenedor.setVisible(true);
    }
    private JPanel volver;
    private Container contenedor;
}
